#!/usr/bin/python3
from tkinter import *

class Application(Frame):
    """Build the basic window frame template"""

    def __init__(self, master):
        super(Application, self).__init__(master)
        self.grid()
        self.create_widgets()

    def create_widgets(self):
        self.label1 = Label(self, text='Select your items')
        self.label1.grid(row=0)
        self.listbox1 = Listbox(self, selectmode=EXTENDED)
        items = ['Item One', 'Item Two', 'Item Three']
        for item in items:
           self.listbox1.insert(END, item)
        self.listbox1.grid(row=1)
        self.button1 = Button(self, text='Submit', command=self.display)
        self.button1.grid(row=2)

    def display(self):
        """Display the selected items"""
        items = self.listbox1.curselection()
        for item in items:
            strItem = self.listbox1.get(item)
            print(strItem)
        print('----------')

root = Tk()
root.title('Listbox widget test')
root.geometry('300x200')
app = Application(root)
app.mainloop()

